/** @file               sw_osd.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_OSD_H__
#define __SW_OSD_H__

#ifdef __cplusplus
extern "C"
{
#endif

typedef SW_VOID             *SW_OSD;
#define SW_INVALID_OSD      NULL

typedef SW_RET(*SW_DRAW_OSD_MASK)(SW_VOID *pImageData, SW_UINT32 imageWidth, SW_UINT32 imageHeight
                                  , SW_IMAGE_FORMAT imageFormat, const SW_RECT *pRect
                                  , const SW_COLOR *pColor);
typedef SW_RET(*SW_DRAW_OSD_IMAGE)(SW_VOID *pImageData, SW_UINT32 imageWidth, SW_UINT32 imageHeight
                                   , const SW_POS *pPos, SW_BOOL blink, SW_IMAGE_FORMAT format
                                   , SW_UINT32 width, SW_UINT32 height, const SW_VOID *pData
                                   , SW_UINT32 dataLen);

typedef struct _SW_OSD_MEM_PROC
{
    SW_MEM_ALLOC_PROC allocProc;
    SW_MEM_REALLOC_PROC reallocProc;
    SW_MEM_FREE_PROC freeProc;
    SW_MEM_COPY_PROC copyProc;
    SW_MEM_FILL_PROC fillProc;
    SW_DRAW_OSD_MASK drawOsdMaskProc;
    SW_DRAW_OSD_IMAGE drawOsdImageProc;
}SW_OSD_MEM_PROC;

SW_API SW_RET SW_InitOsdAPI(SW_VOID);
SW_API SW_RET SW_RunOsdAPI(SW_VOID);
SW_API SW_RET SW_StopOsdAPI(SW_VOID);
SW_API SW_RET SW_ExitOsdAPI(SW_VOID);
SW_API SW_RET SW_SetOsdMemProc(const SW_OSD_MEM_PROC *pMemProc);
SW_API SW_OSD SW_CreateOsd(SW_VOID);
SW_API SW_RET SW_DeleteOsd(SW_OSD osd);
SW_API SW_RET SW_CreateOsdMask(SW_OSD osd, SW_UINT32 index, const SW_RECT *pRect, const SW_COLOR *pColor, SW_BOOL visible, SW_UINT32 order);
SW_API SW_RET SW_DeleteOsdMask(SW_OSD osd, SW_UINT32 index);
SW_API SW_RET SW_SetOsdMaskRect(SW_OSD osd, SW_UINT32 index, const SW_RECT *pRect);
SW_API SW_RET SW_SetOsdMaskColor(SW_OSD osd, SW_UINT32 index, const SW_COLOR *pColor);
SW_API SW_RET SW_SetOsdMaskVisible(SW_OSD osd, SW_UINT32 index, SW_BOOL visible);
SW_API SW_RET SW_SetOsdMaskOrder(SW_OSD osd, SW_UINT32 index, SW_UINT32 order); 
SW_API SW_RET SW_CreateOsdGlyph(SW_OSD osd, SW_UINT32 index, const SW_POS *pPos, const SW_COLOR *pColor, const SW_VOID *pData
                         , SW_UINT32 dataLen, SW_UINT32 width, SW_UINT32 height, SW_BOOL antiAlias, SW_BOOL autoInv
                         , SW_BOOL blink, SW_BOOL visible, SW_UINT32 order);
SW_API SW_RET SW_DeleteOsdGlyph(SW_OSD osd, SW_UINT32 index);
SW_API SW_RET SW_SetOsdGlyphPos(SW_OSD osd, SW_UINT32 index, const SW_POS *pPos);
SW_API SW_RET SW_SetOsdGlyphColor(SW_OSD osd, SW_UINT32 index, const SW_COLOR *pColor);
SW_API SW_RET SW_SetOsdGlyphVisible(SW_OSD osd, SW_UINT32 index, SW_BOOL visible);
SW_API SW_RET SW_SetOsdGlyphOrder(SW_OSD osd, SW_UINT32 index, SW_UINT32 order);
SW_API SW_RET SW_SetOsdGlyphAntiAlias(SW_OSD osd, SW_UINT32 index, SW_BOOL antiAlias);
SW_API SW_RET SW_SetOsdGlyphAutoInv(SW_OSD osd, SW_UINT32 index, SW_BOOL autoInv);
SW_API SW_RET SW_SetOsdGlyphBlink(SW_OSD osd, SW_UINT32 index, SW_BOOL blink);
SW_API SW_RET SW_SetOsdGlyphData(SW_OSD osd, SW_UINT32 index, SW_UINT32 width, SW_UINT32 height
                                 , const SW_VOID *pData, SW_UINT32 dataLen);

SW_API SW_RET SW_CreateOsdImage(SW_OSD osd, SW_UINT32 index, const SW_POS *pPos, const SW_VOID *pData, SW_UINT32 dataLen
                                , SW_UINT32 width, SW_UINT32 height, SW_IMAGE_FORMAT format, SW_BOOL blink, SW_BOOL visible
                                , SW_UINT32 order);
SW_API SW_RET SW_DeleteOsdImage(SW_OSD osd, SW_UINT32 index);
SW_API SW_RET SW_SetOsdImagePos(SW_OSD osd, SW_UINT32 index, const SW_POS *pPos);
SW_API SW_RET SW_SetOsdImageVisible(SW_OSD osd, SW_UINT32 index, SW_BOOL visible);
SW_API SW_RET SW_SetOsdImageOrder(SW_OSD osd, SW_UINT32 index, SW_UINT32 order);
SW_API SW_RET SW_SetOsdImageBlink(SW_OSD osd, SW_UINT32 index, SW_BOOL blink);
SW_API SW_RET SW_SetOsdImageData(SW_OSD osd, SW_UINT32 index, SW_UINT32 width, SW_UINT32 height
                                 , SW_IMAGE_FORMAT format, const SW_VOID *pData, SW_UINT32 dataLen);
SW_API SW_RET SW_DrawOsd(SW_OSD osd, SW_VOID *pData, SW_UINT32 width, SW_UINT32 height, SW_IMAGE_FORMAT format);
SW_API SW_RET SW_CmdDrawOsdGlyphYuv420spUsage(SW_VOID);
SW_API SW_RET SW_CmdDrawOsdGlyphRgb24(const SW_CHAR *pFontFileName, SW_UINT32 fontSize, const SW_CHAR *pGlyphStr
                                      , const SW_CHAR *pImageFileName, SW_UINT32 imageWidth, SW_UINT32 imageHeight
                                      , SW_UINT32 x, SW_UINT32 y, SW_UINT32 color, SW_BOOL antiAlias, SW_BOOL autoInv
                                      , const SW_CHAR *pOutImageFileName);
SW_API SW_RET SW_CmdDrawOsdGlyphYuv420sp(const SW_CHAR *pFontFileName, SW_UINT32 fontSize, const SW_CHAR *pGlyphStr
                                         , const SW_CHAR *pImageFileName, SW_UINT32 imageWidth, SW_UINT32 imageHeight
                                         , SW_UINT32 x, SW_UINT32 y, SW_UINT32 color, SW_BOOL antiAlias, SW_BOOL autoInv
                                         , const SW_CHAR *pOutImageFileName);

#ifdef __cplusplus
}
#endif

#endif

